package one.stand.controller;

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import one.stand.model.CrmSeeRecordModel;
import one.stand.model.ResultModel;
import one.stand.model.ShareRecordModel;
import one.stand.request.*;
import one.stand.response.CompanyRecruitResponse;
import one.stand.response.CompanyResponse;
import one.stand.response.DynamicResponse;
import one.stand.response.DynamicShardRecordResponse;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("company")
@Slf4j
public class CompanyController extends BaseController {

    /**
     * 添加企业
     *
     * @param request
     * @return
     */
    @PostMapping("addCompany")
    public ResultModel<Boolean> addCompany(@RequestBody CompanyRequest request) {
        return companyService.addCompany(request);
    }

    /**
     * 获取企业信息
     *
     * @param request
     * @return
     */
    @PostMapping("getCompany")
    public ResultModel<CompanyResponse> getCompany(@RequestBody CompanyRequest request) {
        return companyService.getCompany(request);
    }

    /**
     * 获取企业信息
     *
     * @param request
     * @return
     */
    @PostMapping("getCompanyId")
    public ResultModel<CompanyResponse> getCompanyId(@RequestBody CompanyRequest request) {
        return companyService.getCompanyId(request);
    }

    /**
     * 查询公司信息
     */
    @PostMapping("getCompanyAllInfo")
    public ResultModel getCompanyAllInfo(@RequestBody CompanyRequest request) {
        return companyService.getCompanyAllInfo(request);
    }

    /**
     * 企业邀请
     *
     * @param request
     * @return
     */
    @PostMapping("invitation")
    public ResultModel<CompanyResponse> invitation(@RequestBody CompanyRequest request) {
        return companyService.invitation(request);
    }

    /**
     * 修改企业
     *
     * @param request
     * @return
     */
    @PostMapping("updCompany")
    public ResultModel<Boolean> updCompany(@RequestBody CompanyRequest request) {
        return companyService.updCompany(request);
    }

    /**
     * 查询公司动态/文章
     *
     * @param request
     * @return
     */
    @PostMapping("selectDynamicInfo")
    public ResultModel<List<DynamicResponse>> selectDynamicInfo(@RequestBody DynamicRequest request) {
        return companyService.selectDynamicInfo(request);
    }

    /**
     * 查询公司动态/文章详细信息 crm-pc
     *
     * @param request
     * @return
     */
    @PostMapping("getDynamicInfo")
    public ResultModel<List<DynamicResponse>> getDynamicInfo(@RequestBody DynamicRequest request) {
        return companyService.getDynamicInfo(request);
    }

    /**
     * 查询公司动态/文章详细信息
     *
     * @param request
     * @return
     */
    @PostMapping("getDynamicInfoPC")
    public ResultModel<Map<String, Object>> getDynamicInfoPC(@RequestBody DynamicRequest request) {
        return companyService.getDynamicInfoPC(request);
    }

    /**
     * 查询所有评论/回复
     *
     * @param request
     * @return
     */
    @PostMapping("selectComment")
    public ResultModel selectComment(@RequestBody CommentRequest request) {
        return companyService.selectComment(request);
    }

    /**
     * 添加/修改公司动态/文章
     *
     * @param request
     * @return
     */
    @PostMapping("addDynamicInfo")
    public ResultModel addDynamicInfo(@RequestBody DynamicRequest request) {
        log.info("addDynamicInfo:{}",request);
        return companyService.addDynamicInfo(request);
    }


    /**
     * 更新动态状态
     * @param request
     * @return
     */
    @PostMapping("updateDynamicState")
    public ResultModel updateDynamicState(@RequestBody DynamicRequest request) {
        log.info("updateDynamicState:{}",request);
        return companyService.updateDynamicState(request);
    }
    /**
     * 解析公众号文章
     */
    @PostMapping("resolverDynamic")
    public ResultModel resolverDynamic(@RequestBody DynamicRequest request) {
        return companyService.resolverDynamic(request);
    }
    /**
     * crm回复
     *
     * @param request
     * @return
     */
    @PostMapping("/doComment")
    public ResultModel doComment(@RequestBody CommentRequest request) {
        return companyService.doComment(request);
    }

    /**
     * crm删除评论
     *
     * @param request
     * @return
     */
    @PostMapping("/delComment")
    public ResultModel delComment(@RequestBody CommentRequest request) {
        return companyService.delComment(request);
    }

    /**
     * 删除公司动态/文章
     *
     * @param request
     * @return
     */
    @PostMapping("delDynamicInfo")
    public ResultModel delDynamicInfo(@RequestBody DynamicRequest request) {
        return companyService.delDynamicInfo(request);
    }

    /**
     * 文章详情
     */
    @PostMapping("getDynamicDetail")
    public ResultModel getDynamicDetail(@RequestBody DynamicRequest request) {
        return companyService.getDynamicDetail(request);
    }

    /**
     * 文章分享记录
     */
    @PostMapping("dynamicShardRecords")
    public ResultModel<List<DynamicShardRecordResponse>> dynamicShardRecords(@RequestBody DynamicRequest request) {
        return companyService.dynamicShardRecords(request);
    }

    /**
     * 文章分享详情
     */
    @PostMapping("dynamicShardRecordDetails")
    public ResultModel<List<ShareRecordModel>> dynamicShardRecordDetails(@RequestBody DynamicRequest request) {
        return companyService.dynamicShardRecordDetails(request);
    }

    @PostMapping("getDynamicPoster")
    @ApiOperation(value = "分享文章海报")
    public ResultModel getDynamicPoster(@RequestBody ShareRecordRequest request) {
        return companyService.getDynamicPoster(request);
    }

    /**
     * 查询公司官网信息
     *
     * @param request
     * @return
     */
    @PostMapping("selectWebsiteInfo")
    public ResultModel selectWebsiteInfo(@RequestBody WebsiteRequest request) {
        return companyService.selectWebsiteInfo(request);
    }

    /**
     * 查询公司官网表单提交信息
     *
     * @param request
     * @return
     */
    @PostMapping("selectDemand")
    public ResultModel selectDemand(@RequestBody DemandRequest request) {
        return companyService.selectDemand(request);
    }

    /**
     * 添加/修改公司官网信息
     *
     * @param request
     * @return
     */
    @PostMapping("addWebsiteInfo")
    public ResultModel addWebsiteInfo(@RequestBody WebsiteRequest request) {
        return companyService.addWebsiteInfo(request);
    }

    /**
     * 添加公司視頻
     *
     * @param request
     * @return
     */
    @PostMapping("insertCompanyVideo")
    public ResultModel<Boolean> insertCompanyVideo(@RequestBody CompanyVideoRequest request) {
        return companyService.insertCompanyVideo(request);
    }

    /**
     * 上下移动公司视频
     *
     * @param request
     * @return
     */
    @PostMapping("moveCompanyVideo")
    public ResultModel<Boolean> moveCompanyVideo(@RequestBody CompanyVideoRequest request) {
        return companyService.moveCompanyVideo(request);
    }

    /**
     * 删除公司視頻
     *
     * @param request
     * @return
     */
    @PostMapping("delCompanyVideo")
    public ResultModel<Boolean> delCompanyVideo(@RequestBody CompanyVideoRequest request) {
        return companyService.delCompanyVideo(request);
    }

    /**
     * 查询公司招聘信息
     *
     * @param request
     * @return
     */
    @PostMapping("selectCompanyRecruit")
    public ResultModel<List<CompanyRecruitResponse>> selectCompanyRecruit(@RequestBody CompanyRecruitRequest request) {
        return companyService.selectCompanyRecruit(request);
    }

    /**
     * 添加/修改公司招聘信息
     *
     * @param request
     * @return
     */
    @PostMapping("addCompanyRecruit")
    public ResultModel addCompanyRecruit(@RequestBody CompanyRecruitRequest request) {
        return companyService.addCompanyRecruit(request);
    }

    /**
     * 添加招聘HR电话
     *
     * @param request
     * @return
     */
    @PostMapping("addHrPhone")
    public ResultModel addHrPhone(@RequestBody CompanyRequest request) {
        return companyService.addHrPhone(request);
    }

    /**
     * 删除公司招聘信息
     *
     * @param request
     * @return
     */
    @PostMapping("delCompanyRecruit")
    public ResultModel delCompanyRecruit(@RequestBody CompanyRecruitRequest request) {
        return companyService.delCompanyRecruit(request);
    }

    /**
     * crmPC-支付
     */
    @PostMapping("/payment")
    public ResultModel<String> payment(@RequestBody CompanyAccountRequest request) {
        return companyService.payment(request);
    }

    /**
     * 回调
     */
    @PostMapping("/backPayMent")
    public String backPayMent(@RequestParam(value = "request") String request) {
        return companyService.backPayMent(request);
    }

    /**
     * 企业移交oem
     *
     * @param companyRequest
     * @return
     */
    @PostMapping("companyTransfer")
    public ResultModel<Boolean> companyTransfer(@RequestBody CompanyRequest companyRequest) {
        return companyService.transformCompany(companyRequest);
    }

    /**
     * 查询代理商企业下公司的信息
     *
     * @param request
     * @return
     */
    @PostMapping("selectAgentCompanyList")
    public ResultModel<Map<String, Object>> selectAgentCompanyList(@RequestBody CompanyRequest request) {
        return companyService.selectAgentCompanyList(request);
    }

    /**
     * 查询企业信息
     *
     * @param request
     * @return
     */
    @PostMapping("getAdminCompanyInfo")
    public ResultModel<CompanyResponse> getAdminCompanyInfo(@RequestBody CompanyRequest request) {
        return companyService.getCompanyInfo(request);
    }

    /**
     * 获取商品分享海报图
     *
     * @param request
     * @return
     */
    @PostMapping("invitePoster")
    public ResultModel<String> invitePoster(@RequestBody CompanyRequest request) {
        return companyService.invitePoster(request);
    }

}
